<?php
include("../Services/Autoload.php");
class Services_Filter{
	private $util;
	public function __construct(){
		$this->util = new Services_Utility();
	}
	public function filter($string){
		var_dump($this->util);
	}
	
	/*
	 *去掉字符串的换行
	 */
	public function replaceString($string){
		$string = trim($string);
		$string = str_replace("\t","",$string);
		$string = str_replace("\r\n","",$string);
		$string = str_replace("\n","",$string);
		return $string;
	}
	
	/*
	 * 替换收藏模块店铺名称
	 */
	public function replaceShopName($string){
		$nick = $_SESSION['nick'];
		$shopInfo = $this->getShopInfo(['nick'=>$nick]);
		if(!$shopInfo['error_response']){
			$shopName = $shopInfo['shop_get_response']['shop']['title'];
			$logoPath = 'https://img.alicdn.com'.$shopInfo['shop_get_response']['shop']['pic_path'];
			$replaceString = str_replace('shopname_tms',$shopName,$string);
			$replaceString = str_replace('shoplogo_tms',$logoPath,$replaceString);
		}
		return $replaceString ? $replaceString : $string;

	}
}
?>